<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue"></script>
  <style>
    /* 动画 */
    @keyframes shake {
      0% {
        opacity: 0;
        font-size: 14px;
      }

      50% {
        opacity: 0.3;
        font-size: 60px;
      }

      100% {
        opacity: 1;
        font-size: 40px;
      }
    }

    .v-enter-active,
    .v-leave-active {
      animation: shake 3s linear;
    }

    /* 过渡 */
    /* .v-enter-from {
      opacity: 0;
    }

    .v-enter-active,
    .v-leave-active {
      transition: opacity 3s ease-out;
    }

    .v-enter-to {
      opacity: 1;
    }

    .v-leave-to {
      opacity: 0;
    } */
  </style>
</head>

<body>
  <div id="root"></div>
  <script>
    /* 
      1. 理解入场和出场概念
      - 从隐藏到显示 入场
      - 从显示到隐藏 出场
      2. vue中的transition组件 实现单元素/组件的动画
      - 使用transition组件
      - 定义v-enter-from 入场开始类
      - 定义v-enter-to 入场结束类
      - 定义v-enter-active 入场过渡过程动画类
      - 定义v-leave-from 出场开始类
      - 定义v-leave-to 出场结束类
      - 定义v-leave-active 出场过渡过程动画类
    */
    const app = Vue.createApp({
      template: `
      <transition>
        <div v-if="isShow">Hello World1</div>
      </transition>
      <button @click="isShow = !isShow">切换</button>
    `,
      data() {
        return {
          isShow: false
        }
      }
    })
    const vm = app.mount('#root');

  </script>
</body>

</html>